<?php

if(!BASEPATH) die('No direct script access');

/*
|--------------------------------------------------------------------------
| Includes
|--------------------------------------------------------------------------
|
| Includes the required files in order for everything to work
|
*/


	/*
	|--------------------------------------------
	| Globals
	|--------------------------------------------
	|
	| Includes the globals file, so we can use
	| all the defined paths and configurations
	|
	*/
	require_once(TANAXIA . 'Globals' . EXT);
	
	/*
	|--------------------------------------------
	| Tanaxia_Core
	|--------------------------------------------
	|
	| Includes the Tanaxia_Core
	|
	*/
	require_once(SYS_CORE . 'Tanaxia_Core' . EXT);
	
	/*
	|--------------------------------------------
	| Tanaxia_Exceptionhandler
	|--------------------------------------------
	|
	| Includes the Tanaxia_Exceptionhandler
	|
	*/
	require_once(SYS_CORE . 'Tanaxia_Exceptionhandler' . EXT);
	
	

	

/*
|--------------------------------------------------------------------------
| Load
|--------------------------------------------------------------------------
|
| Loads the core classes and the classes from autoload config file
|
*/
	
	/*
	|--------------------------------------------
	| Tanaxia_Config
	|--------------------------------------------
	|
	| Loads the Tanaxia_Config which makes you
	| able to access config-items from config.php
	|
	*/
	Tanaxia_Core::core('Tanaxia_Config', 'config');
	
	/*
	|--------------------------------------------
	| Tanaxia_Base
	|--------------------------------------------
	|
	| Loads the Tanaxia_Base which all your models,
	| controllers and libraries extends from
	|
	*/
	Tanaxia_Core::core('Tanaxia_Base', null);
	
	/*
	|--------------------------------------------
	| POT
	|--------------------------------------------
	|
	| Loads POT
	|
	*/
	Tanaxia_Core::POT();
	
	/*
	|--------------------------------------------
	| Autoload
	|--------------------------------------------
	|
	| Autoloads the specified models, libraries,
	| helpers and plugins in autoload config file
	|
	*/
	Tanaxia_Core::autoload();	
	
	/*
	|--------------------------------------------
	| URI
	|--------------------------------------------
	|
	| Loads the URI core so we can extract the
	| URI from the URL
	|
	*/
	$URI = Tanaxia_Core::core('Tanaxia_URI', 'uri');
	
	/*
	|--------------------------------------------
	| Loader
	|--------------------------------------------
	|
	| Loads the Loader core so that we can load
	| models, helpers, libraries, views and
	| controllers
	|
	*/
	$LDR = Tanaxia_Core::core('Tanaxia_Loader', 'load');
	
	/*
	|--------------------------------------------
	| Router
	|--------------------------------------------
	|
	| Loads the router class so that it can route
	| us to the correct controller based on the
	| URI
	|
	*/
	$RTR = Tanaxia_Core::core('Tanaxia_Router');
	
/*
|--------------------------------------------------------------------------
| Run
|--------------------------------------------------------------------------
|
| Runs the application and catches all possible errors
|
*/

	try
	{
	
		$RTR->initiate($URI->uri);
		
	}
	catch(Exception $e)
	{
	
		Tanaxia_Exceptionhandler::show($e);
		
	}
	
	
// End of Tanaxia.php